<%--
  Created by IntelliJ IDEA.
  User: daiyuhua
  Date: 2021/5/3
  Time: 18:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>


<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link rel="stylesheet" href="<%=path%>/css/pintuer.css">
    <link rel="stylesheet" href="<%=path%>/css/admin.css">
    <link rel="stylesheet" href="<%=path%>/third/zTree_v3/css/zTreeStyle/zTreeStyle.css">
    <script src="<%=path%>/js/jquery.js"></script>
    <script src="<%=path%>/js/pintuer.js"></script>
    <script src="<%=path%>/js/vue.js"></script>
    <script type="text/javascript" src="<%=path%>/third/zTree_v3/js/jquery.ztree.all.min.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>增加行政区域</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="<%=path%>/roleAddAction">
            <div class="form-group">
                <div class="label">
                    <label>区域编号：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="" name="areaid" data-validate="required:请输入区域编号" />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>区域名：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="" name="areaname" data-validate="required:请输入区域名" />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>区域等级：</label>
                </div>
                <div class="field">
                    <div class="field">
                        <ul id="tree" class="ztree">
                            <input type="hidden" id="test" name="test"/>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    $(function(){
        var setting={
            check: {
                chkboxType: {"Y":"p","N":"p"},
                enable: true,
                chkStyle: "checkbox"//显示 checkbox 选择框，默认checkbox可选择值radio
            },
            data: {
                simpleData:{
                    enable: true,
                    idKey: "id",
                    pIdKey: "areaLevel",
                    rootPId: 0
                },
                key:{
                    name: "areaName"
                }
            }
        };
        $(document).ready(function () {
            $.ajax({
                type:"get",
                dataType: "json",
                url:"<%=path%>/findAllArea",
                async:true,
                success:function (res){
                    var zTreeObject = $.fn.zTree.init($("#tree"),setting,res.arealist);
                    zTreeObject.expandAll(true);
                }
            });
        });
    });
</script>
